import java.util.Deque;
import java.util.LinkedList;
import java.util.Queue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 74646
 * Date: 2022-02-28
 * Time: 12:47
 */
public class TestDemo {
    public static void main(String[] args) {
        Deque<Integer> deque = new LinkedList<>();
        //入队(队头插入元素)头插法
        deque.addFirst(1);
        deque.offerFirst(2);
        deque.offerFirst(3);
        //获取队头元素
        System.out.println(deque.peekFirst());
        //出队(队头元素)
        System.out.println(deque.removeFirst());
        System.out.println("===============");
        //入队(队尾巴插入元素)头插法
        deque.offerLast(1);
        deque.offerLast(2);
        deque.offerLast(3);
        //获取队头元素
        System.out.println(deque.peekFirst());
        //出队(队头元素)
        System.out.println(deque.removeFirst());
    }
}
